import allure
import pytest
from utils.configurator import config

# 操作前先登录
from web_test.page.dept.dept_page import DeptPage


# @pytest.fixture(name="login", scope="session", autouse=True)
# def login(app):
#     with allure.step("Log in feishu"):
#         login = app.goto_login_page()
#
#         yield login_page.login(config["account"]["username"], config["account"]["password"])

@pytest.fixture(name="dept_page", scope="session")
def init_dept_page(app):
    with allure.step("goto dept"):
        print(f'fixture: dept_page OK')
        # dept_page = app.goto_func_page('组织架构', '成员与部门')
        # dept_page = app.goto_func_page(url='https://wjvzp7x5tz.feishu.cn/admin/contacts/departmentanduser')
        # dept_page = app.goto_dept_page()
        dept_page = DeptPage()

        yield dept_page
        print(f"\nteardown_class")
        # print(dept_page.dept_names)
        # dept.delete_dept()